package com.capgemini.simpleappblanche.services.security.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.capgemini.simpleappblanche.dao.security.IUserDao;
import com.capgemini.simpleappblanche.domain.security.User;
import com.capgemini.simpleappblanche.services.security.IUserService;

@Service
@Transactional
@PreAuthorize("denyAll")
public class UserService implements IUserService {

    @Autowired
    private IUserDao accountDao;

    /**
     * {@inheritDoc}
     * @see com.springinpractice.ch07.service.AccountService#getAccountByUsername(java.lang.String)
     */
    @PreAuthorize("hasRole('PERM_READ_USER')")
    public User getAccountByUsername(String username) {
        return accountDao.getByUsername(username);
    }
}
